
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript" src="scripts/rand_password.js"></script>
<title>New Account Request</title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<?php include('includes/path.php'); ?>
<?php include('db.php'); ?>
<script Language="JavaScript">

function Blank_TextField_Validator()
{
// Check the value of the element named text_name from the form named text_form


if (login.Login.value == "")
{
  // If null display and alert box
   alert("Email field is blank!");
  // Place the cursor on the field for revision
   login.Login.focus();
  // return false to stop further processing
   return (false);
}
// If text_name is not null continue processing
  alert("returning true!");
return (true);
}

</script>
</head>

<body class="oneColFixCtrHdr">
<div id="container">
<?php include( 'includes/header.php' ); ?>
<?php include( 'includes/menu.php' ); ?>
    <div id="mainContent">
    
   <div style="width: 550px; margin: auto;">
<h1>Request New Account</h1>


<form action="newaccount.php" method="post" enctype="multipart/form-data" name="newaccount" target="_parent">

<?php

$CON = mysql_connect( $HOST, $USER, $PASS );

$TABLE = "New_Accounts";

mysql_select_db($DB);

if (!$CON){
    die('Could not connect: '.mysql_error());
}

$Login = (string)(isset($_POST['Login']) ? htmlspecialchars($_POST['Login']) : '');
//echo $Login;
$Login = $Login."@marssneers.com";
$fname = (isset($_POST['fName']) ? htmlspecialchars($_POST['fName']) : '');
//echo $fname;
$lname = (isset($_POST['lName']) ? htmlspecialchars($_POST['lName']) : '');
//echo $lname;
$question = (isset($_POST['question']) ? htmlspecialchars($_POST['question']) : '');
//echo $fname;
$answer = (isset($_POST['answer']) ? htmlspecialchars($_POST['answer']) : '');
//echo $lname;



//mysql_query("INSERT INTO Vendors (vendor_id, company_name) VALUES ($number, '$input')");
$SQL = "INSERT INTO New_Accounts (email, first_name, last_name, question, answer) VALUES ('$Login', '$fname', '$lname', '$question', '$answer')";
if(!($Login=='@marssneers.com')){
    

    
    if(!mysql_query($SQL)){
        //echo $SQL;
        die('Error: '.mysql_error());
}
    else{
        //echo $SQL;
        echo "Record Added";
    }
}




mysql_close($CON);

?>
    
</form>

<script Language="JavaScript">
<!-- 
function Validator(myForm)
{
// Check the value of the element named text_name from the form named text_form
if (myForm.Login.value.trim() == "" || myForm.fname.value.trim() == "" || myForm.lname.value.trim() == "" || myForm.question.value.trim() == "" || myForm.answer.value.trim() == "")
{
  // If null display and alert box
   alert("You are missing data!");
  // Place the cursor on the field for revision
   newaccount.Login.focus();
  // return false to stop further processing
   return (false);
}
// If text_name is not null continue processing
return (true);
}
-->
</script>


<form action="newaccount.php" method="post" enctype="multipart/form-data" name="newaccount" target="_parent" onsubmit="return Validator(this)">
        <table style="background-color: #efefef; height: 90%; text-align: right; padding: 25px; border: groove 5px #D6B376;">
                <tr><td style="width:20%;"><p>Email: </p></td><td style="width:40%;"><input style="width: 50%;" name="Login" type="text" />@marssneers.com</td></tr>
                <tr><td style="width:20%;"><p>First Name: </p></td><td style="width:40%; text-align: left;"><input style="width: 50%;" name="fName" type="text" /></td></tr>
                <tr><td style="width:20%;"><p>Last Name: </p></td><td style="width:40%; text-align: left;"><input style="width: 50%;" name="lName" type="text" /></td></tr>
                <tr><td style="width:20%;"><p>Security Question: </p></td><td style="width:40%; text-align: left;"><input style="width: 50%;" name="question" type="text" /></td></tr>
                <tr><td style="width:20%;"><p>Answer: </p></td><td style="width:40%; text-align: left;"><input style="width: 50%;" name="answer" type="text" /></td></tr>
                <tr><td style="font-size: 10px; text-align: center;"></td><td><input name="NewAccount" type="submit" value="Request Account" />  </td></tr>
        </table>    
    
    </form>



   </div>
  <!-- end #mainContent --></div>
<?php include('includes/footer.php'); ?>
<!-- end #container --></div>
</body>
</html>
